<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.is.util.DateTime"%>
<%@page import="java.util.List"%>
<%@page import="com.is.model.*"%>
<%@page import="com.is.control.ParamClassControl"%>
<%@page import="com.is.control.ParamStuyearControl"%>
<%@page import="com.is.control.StudentControl"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="/InterStu/resources/image/favicon.ico" />
<link rel="stylesheet" type="text/css" href="../../resources/css/all.css" />
<script type="text/javascript" src="../../resources/js/jquery-1.8.1.js"></script>
<script type="text/javascript" src="../../resources/js/WebCalendar.js"></script>
<link href="../../resources/css/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../resources/js/jquery.artDialog.js"></script>
<script type="text/javascript" src="../../resources/js/iframeTools.js"></script>
<script type="text/javascript">
	$(function(){
		var block = $("#magic_block");
		if($(".active a").position()){
			block.css("top",$(".active a").position().top+10)
			.data("oriTop",$(".active a").position().top)
		}
		$(".nav ul li").find("a").hover(
			function(){
				var $this = $(this);
				var newTop = $this.position().top;
				block.stop().animate({
					top:newTop+10
				})
			},
			function(){
				block.stop().animate({
					top:block.data("oriTop")+10
				})
			}
		)
		$("#added_class").hide();
		$("#update_class").hide();
		$(".add_class").click(function(){
			$.dialog({
				title:"添加班级",
				cancel:true,
				cancelVal:"返回",
				content:document.getElementById("added_class")
			})
		})
		$(".copy_class").click(function(){
			$.dialog.open("copy_class.jsp",{width:350,title:"复制班级"});
		})
		$(".update_class").click(function(){
			var temurl = $(this).attr("rel");
			$("[name='update_form']")[0].action = temurl;
			$("[name='update_class_name']").val($(this).parent().prev().prev().html())
			$.dialog({
				title:"修改班级",
				cancel:true,
				cancelVal:"返回",
				content:document.getElementById("update_class")
			})
		})
		$(".delete_class").click(function(){
			var tempurl = $(this).attr("rel");
			var stu_num = $(this).parent().prev().html();
			var tea_num = $(this).prev().val();
			if(stu_num*1 + tea_num*1>0){
				$.dialog({
				title:"删除提示",
				icon:"error",
				content:"对不起，该班级正在使用中</br>系统不能删除。</br>",
				okValue:"确定",
				ok:function(){
				
				}
			}) 
			}else{
				window.location = tempurl;
			}
		})
		var h = $(".right").height();
		$(".left").height(h);
		$(".update").click(function(){
			$.dialog.open("/InterStu/update_info.jsp",{width:460,height:400,title:"个人信息"});
		})
		$('img').error(function(){
			this.src = "/InterStu/resources/image/man.GIF";
		})
	})
</script>
<title>留学生预科班</title>
</head>
<% 
	 User cu =(User)session.getAttribute("user"); 
%>
<body>
<div class="header">
	<div class="title pr">
    	<a href="javascript:void(0);"><span class="update pa">个人信息</span></a>
        <span class="logout pa"><a class="hide" href="/InterStu/login/logout.jsp">退出</a></span>
    </div>
</div>
<div class="main">
	<div class="left"> 
	  <div class="infomation">
			<div class="photo">
			<%
			String picUrl = cu.getPicUrl();
			%>
				<img width='60' height="60" src = "<%=picUrl %>"  />
			</div>
			<div class="welcome">
				<%=cu.getName() %>,<br/>
				欢迎您使用！
			</div>
		</div>  	   	
    	<div class="nav">
        	<ul>	
            	<li class="pa" id="magic_block"></li>
                <li class="active"><a href="/InterStu/pages/stuyear/stuyear_start.jsp">新学期设置</a></li>
                <li><a href="/InterStu/pages/users/user_all.jsp">用户管理</a></li>
                <li><a href="/InterStu/pages/students/student_add.jsp">学生管理</a></li>
                <li><a href="/InterStu/pages/dictation/dictation_add.jsp">学生考核</a></li>
                <li><a href="/InterStu/pages/assess/teacher_assess.jsp">教职人员管理</a></li>
            </ul>
        </div>    
   </div>
    <div class="right">
    	<div class="r1">
    		<table class="term tab">
    <tr>
    	<td>
    		<a href="/InterStu/pages/stuyear/stuyear_start.jsp">学期开关</a>
		</td>
		<td>
			<a class="current" href="../paramClass/param_class_add.jsp">班级设置</a>
		</td>
		<td>
			<a href="/InterStu/pages/paramCourse/course.jsp">添加课程</a> 
		</td>
    </tr>
    </table>
			<table class='table'>
			<% 
    		   List<ParamClass> pcs = ParamClassControl.getParamClassesByStuyear(ParamStuyearControl.getCurrentStuyearId());
		       if(pcs.size()==0){
		    	   out.print("<caption>当前学期（"+ParamStuyearControl.getCurrentStuyear().getStuyear()+"）"+"尚无班级</caption>");
		       }else{
		    	   out.print("<caption>当前学期（"+ParamStuyearControl.getCurrentStuyear().getStuyear()+"）"+"已有"+pcs.size()+"个班级</caption");
    		%>
    		<thead>
			<tr>
				<th width="33%">班级</th>
				<th width="33%">人数</th>
				<th>操作</th>
			</tr>
			</thead>
			<%
			for(int i=0;i<pcs.size();i++){
			%>
				<tr>
			<%
			    ParamClass pc = pcs.get(i);
			    %>
			    <td><%=pc.getClassName() %></td>
			    <td><%=StudentControl.getCountByClassId(pc.getId()) %></td>
			    <td><input type="hidden" value="<%=StudentControl.getCountTeacherByClassId(pc.getId()) %>"/><a class="delete_class" href="javascript:void(0);" rel="param_class_delete_do.jsp?id=<%=pc.getId() %>">删除</a>
			     <a>|</a> 
			     <a class="update_class" href="javascript:void(0);" rel="param_class_update_do.jsp?id=<%=pc.getId() %>" >修改</a></td>
			 	</tr>
			<%
				}
			%>
			<%} %>
			</table>
			<br/>
			<input type="button" class="add_class" value="添加班级"/>
			&nbsp;&nbsp;&nbsp;
			<input type="button" class="copy_class" value="复制班级"/>
    	</div>
    </div>
</div>
	<div id="added_class">
		<form action="param_class_add_do.jsp" method="post">
		班级名称：&nbsp;<input type="text" name="class_name"  autocomplete="off" />&nbsp;&nbsp;&nbsp;
		<input type="submit" value="确定"/><br/><br/>
		</form>
	</div>
	<div id="update_class">
		<form name="update_form" action="param_class_update_do.jsp" method="post">
		班级名称：&nbsp;<input type="text" name="update_class_name"  autocomplete="off" />&nbsp;&nbsp;&nbsp;
		<input type="submit" value="确定"/><br/><br/>
		</form>
	</div>
<div class="footer">
	<p>版权所有：东北师范大学留学生预科部&nbsp;&nbsp;  蓝旭工作室开发</p>
</div>
</body>
</html>

